<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "class1".
 *
 * @property integer $id
 * @property string $name
 *
 * @property Class2[] $class2s
 * @property Comment[] $comments
 * @property DataRelationship[] $dataRelationships
 * @property ListenContent[] $listenContents
 * @property Notebook[] $notebooks
 * @property ReadContent[] $readContents
 * @property SpeakContent[] $speakContents
 * @property WriteQuestion[] $writeQuestions
 */
class Class1 extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'class1';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'name'], 'required'],
            [['id'], 'integer'],
            [['name'], 'string', 'max' => 10],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getClass2s()
    {
        return $this->hasMany(Class2::className(), ['class1_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getComments()
    {
        return $this->hasMany(Comment::className(), ['class1_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getDataRelationships()
    {
        return $this->hasMany(DataRelationship::className(), ['class1_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getListenContents()
    {
        return $this->hasMany(ListenContent::className(), ['class1_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getNotebooks()
    {
        return $this->hasMany(Notebook::className(), ['class1_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getReadContents()
    {
        return $this->hasMany(ReadContent::className(), ['class1_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getSpeakContents()
    {
        return $this->hasMany(SpeakContent::className(), ['class1_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getWriteQuestions()
    {
        return $this->hasMany(WriteQuestion::className(), ['class1_id' => 'id']);
    }
}
